/*
* @Author: majingyu
* @Date:   2017-05-25 21:40:40
* @Last Modified by:   majingyu
* @Last Modified time: 2017-05-26 22:54:29
*/

import initialState from '../state';

function userReducer(state = initialState.user, action){
    switch(action.type){
        case 'GET_USER_SUCCESS':
            return Object.assign({}, state, {
                user: action.data
            })
        case 'SUBMIT_EVALUATE_BIGIN':
            return Object.assign({}, state, {
                user: {
                    evaluate: action.data
                }
            })
        case 'SUBMIT_EVALUATE_SUCCESS':
            return Object.assign({}, state, {
                user: {
                    evaluate: action.data
                }
            })
        case 'SUBMIT_EVALUATE_ERROR':
        return Object.assign({}, state, {
            user: {
                evaluate: action.data
            }
        })
        default :
            return state;
    }
}

export default userReducer;